home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CUJ9204.ARJ / 1004090B < prev    next >
Text File  |  1992-06-02  |  478b  |  29 lines

  1.  
  2. void push(stack *, int);
  3. int pop(stack *);
  4.  
  5. main()
  6. {
  7.     int size = 50;
  8.  
  9.     stack3.pstack = malloc(size * sizeof(int));
  10.     if (stack3.pstack == NULL) {
  11.         printf("Can't allocate space for stack3\n");
  12.         exit(1);
  13.     }
  14.  
  15.     stack3.max_stack = size;
  16.  
  17.     push(&stack1, 10);
  18.     push(&stack1, 12);
  19.     push(&stack2, 15);
  20.     push(&stack3, 20);
  21.     printf("stk1: %d\n", pop(&stack1));
  22.     printf("stk2: %d\n", pop(&stack2));
  23.     printf("stk3: %d\n", pop(&stack3));
  24.     printf("stk3: %d\n", pop(&stack3));
  25.  
  26.     return 0;
  27. }
  28.  
  29.